<?
include "../../config/ini.php";

$id	= (int)$_GET['id'];

if($id > 0){	
	$objTaskDAO	= new TaskDAO($db_Mysql);
	$file = $objTaskDAO->getAnnexes($id, 0);

	$link = DIRETORIO.'files/tasks/'.$file[0]->idTask.'/'.$file[0]->idTaskFile.'.'.$file[0]->extension;
	
	if(is_file($link)){
		header ("Content-Type: application/octet-stream");
		header ("Content-Disposition: attachment;filename=".$file[0]->title);
		header ("Content-Length: ".filesize($link));
		readfile($link);
		exit();
	}
}

exit("Não foi possível encontrar o arquivo!");
?>